import { createBrowserRouter } from 'react-router-dom';
import Layout from '../components/Layout';
import Home from '../pages/home/Home';
import Recommendations from '../pages/recommendations/Recommendations';
import Create from '../pages/create/Create';
import Login from '../pages/auth/Login';
import Register from '../pages/auth/Register';
import ForgotPassword from '../pages/auth/ForgotPassword';
import Profile from '../pages/user/Profile';
import MyContents from '../pages/user/MyContents';
import AdminReview from '../pages/admin/AdminReview';
import AdminApplicationsList from '../pages/admin/AdminApplicationsList';
import AdminContentManagement from '../pages/admin/AdminContentManagement';
import RecommendationAdmin from '../pages/admin/RecommendationAdmin';
import Logs from '../pages/logs/Logs';

const router = createBrowserRouter([
  {
    path: '/',
    element: <Layout />,
    children: [
      {
        index: true,
        element: <Home />,
      },
      {
        path: 'home',
        element: <Home />,
      },
      {
        path: 'recommendations',
        element: <Recommendations />,
      },
      {
        path: 'create',
        element: <Create />,
      },
      {
        path: 'profile',
        element: <Profile />,
      },
      {
        path: 'my-contents',
        element: <MyContents />,
      },
      {
        path: 'admin/applications',
        element: <AdminApplicationsList />,
      },
      {
        path: 'admin/review/:userId',
        element: <AdminReview />,
      },
      {
        path: 'admin/content-management',
        element: <AdminContentManagement />,
      },
      {
        path: 'admin/recommendation-management',
        element: <RecommendationAdmin />,
      },
      {
        path: 'logs',
        element: <Logs />,
      },
    ],
  },
  // 认证页面独立，不使用Layout
  {
    path: '/auth/login',
    element: <Login />,
  },
  {
    path: '/auth/register',
    element: <Register />,
  },
  {
    path: '/auth/forgot-password',
    element: <ForgotPassword />,
  },
]);

export default router; 